package com.ssf.domain.strategy.repository;

import com.ssf.domain.strategy.model.entity.StrategyAwardEntity;
import com.ssf.domain.strategy.model.entity.StrategyRuleEntity;

import java.util.HashMap;
import java.util.List;

public interface IStrategyRepository {
    /**
     * 根据策略取出对应策略奖品类，并转换为领域实体，存入列表
     * @param strategyId 策略id
     * @return
     */
    List<StrategyAwardEntity> getStrategyAwardEntityByStrategyId(Long strategyId);

    /**
     * 将抽奖map和随机数范围保存到缓存中
     * @param key 抽奖key
     * @param lotteryRange 随机数抽取范围
     * @param map 抽奖map
     */
    void restoreLotteryMap(String key, int lotteryRange, HashMap<Integer, Integer> map);

    /**
     * 返回随机数抽取范围
     * @return
     */
    int getLotteryRange(String key);

    /**
     * 返回抽奖map
     * @param key redisKey的后半部分
     * @return
     */
    HashMap<Integer, Integer> getLotteryMap(String key);

    /**
     *
     * @param strategyId
     * @return
     */
    List<StrategyRuleEntity> getStrategyRuleEntityByStrategyId(Long strategyId);

    /**
     *
     * @param strategyId
     * @param awardId
     * @return
     */
    List<StrategyAwardEntity> getStrategyAwardEntityByStrategyIdAndAwardId(Long strategyId, List<Integer> awardId);
}
